package com.yoj.serviceclient.service.question;

import com.yoj.serviceclient.service.question.fallback.QuestionFeignClientFallback;
import com.yoj.model.entity.Question;
import com.yoj.model.entity.QuestionSubmit;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author admin
 * @description 针对表【question(题目表)】的数据库操作Service
 * @createDate 2024-06-29 15:45:07
 */
@FeignClient(name ="yoj-question-service", path = "/api/question/inner", fallback = QuestionFeignClientFallback.class)
public interface QuestionFeignClient {

    /**
     * 根据 id 查询题目
     */
    @GetMapping("/get/id")
    Question getQuestionById(@RequestParam("questionId") long questionId);

    /**
     * 根据 id 更新题目
     */
    @PostMapping("/question/update")
    boolean updateQuestionById(@RequestBody Question question);

    /**
     * 根据题目提交 id 查询题目提交
     */
    @GetMapping("/question_submit/id")
    QuestionSubmit getQuestionSubmitById(@RequestParam("questionSubmitId") long questionSubmitId);

    /**
     * 根据题目提交 id 更新题目提交
     */
    @PostMapping("/question_submit/update")
    boolean updateQuestionSubmitById(@RequestBody QuestionSubmit questionSubmit);
}